package org.jackysoft.entity;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.jackysoft.entity.AbstractEntity;
import org.jackysoft.entity.Department;
@Entity
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true) 
public class ForwardStore extends AbstractEntity {
   
   
	/**
	 * 
	 */
	private static final long serialVersionUID = 3582562160326056930L;

	private Product owner;
    private ProductType itemType;

	private Department department;
	private Integer year;
	private Integer month;
	private Double yearValue;
	private Double monthValue;	
	
	public ForwardStore(){
		
	}  	
	
	public ForwardStore(Double yearval,Double monthval){
		this.yearValue = yearval;
		this.monthValue = monthval;
	}	

	public Double getYearValue() {
		return yearValue;
	}

	public void setYearValue(Double yearValue) {
		this.yearValue = yearValue;
	}

	public Double getMonthValue() {
		return monthValue;
	}

	public void setMonthValue(Double monthValue) {
		this.monthValue = monthValue;
	}
	
	@ManyToOne
	public Department getDepartment() {
		return department;
	}
	public void setDepartment(Department department) {
		this.department = department;
	}



	@ManyToOne
	public Product getOwner() {
		return owner;
	}



	public void setOwner(Product owner) {
		this.owner = owner;
	}

	@Transient
	public DataItem getDataItem(){
		DataItem di =  new DataItem();
		di.setAtomValue(this.yearValue);
		di.setAccumulateValue(this.monthValue);
		return di;
		
	}

	@Override
	public String toString() {
		
		return this.owner.code+"-["+this.department.getId()+">"+this.department.getName()+"]-["+this.yearValue+"]-["+this.monthValue+"]";
	}

	public Integer getYear() {
		return year;
	}

	public void setYear(Integer year) {
		this.year = year;
	}

	public Integer getMonth() {
		return month;
	}

	public void setMonth(Integer month) {
		this.month = month;
	}

	public ProductType getItemType() {
		return itemType;
	}

	public void setItemType(ProductType itemType) {
		this.itemType = itemType;
	}
	
	



}